package com.three.iot.commons.enums;

import java.util.Objects;

/**
 * @author luiz
 * @Title: ResultCode
 * @ProjectName iot
 * @Description: 显示类型枚举
 * @date 2019-04-03 16:00
 *
 */
public enum ShowTypeEnum {
    ZHEXIAN("10", "折线图"),
    YIBIAOPAN("20", "仪表盘"),
    WENBEN("30", "文本框"),
    KAIGUAN("40", "开关"),
    ;

    String code;
    String name;

    ShowTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static final ShowTypeEnum matching(String code) {
        for (ShowTypeEnum resultCode : ShowTypeEnum.values()) {
            if (Objects.equals(resultCode.getCode(), code)) return resultCode;
        }
        return null;
    }
}
